/*
 * Powered By [rapid-framework]
 * Web Site: http://www.rapid-framework.org.cn
 * Google Code: http://code.google.com/p/rapid-framework/
 * Since 2008 - 2011
 */

package com.hibernate.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.javacommon.base.BaseEntity;
import org.hibernate.validator.constraints.Length;

/**
 * @author badqiu email:badqiu(a)gmail.com
 * @version 1.0
 * @since 1.0
 */


@Entity
@Table(name = "GROUPS")
public class Groups extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;
	
	//date formats
	

	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
	
	private Long id;

	@Length(max=1000)
	private java.lang.String materialstr;
	
	private java.lang.Long shownum;
	//columns END
	
	private Long planid;

	public Groups(){
	}

	public Groups(
		Long id
	){
		this.id = id;
	}

	

	public void setId(Long value) {
		this.id = value;
	}
	
	@Id
	@GeneratedValue(generator = "paymentableGenerator")       
	@GenericGenerator(name = "paymentableGenerator", strategy = "native") 
	@Column(name = "ID", unique = true, nullable = false, insertable = true, updatable = true, length = 20)
	public Long getId() {
		return this.id;
	}

	@Column(name = "PLANID")
	public Long getPlanid() {
		return planid;
	}

	public void setPlanid(Long planid) {
		this.planid = planid;
	}
	
	@Column(name = "MATERIALSTR")
	public java.lang.String getMaterialstr() {
		return materialstr;
	}

	public void setMaterialstr(java.lang.String materialstr) {
		this.materialstr = materialstr;
	}

	@Column(name = "SHOWNUM", unique = false, nullable = true, insertable = true, updatable = true, length = 10)
	public java.lang.Long getShownum() {
		return this.shownum;
	}
	


	public void setShownum(java.lang.Long value) {
		this.shownum = value;
	}
	

	
	
	@Override
	public String toString() {
		return "Groups [id=" + id + ", materialstr=" + materialstr
				+ ", shownum=" + shownum + ", planid="
				+ planid + "]";
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof Groups == false) return false;
		if(this == obj) return true;
		Groups other = (Groups)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
	@Transient
	@Override
	public String getTarget() {
		// TODO Auto-generated method stub
		return "分组";
	}
	@Transient
	@Override
	public Long getTargetId() {
		// TODO Auto-generated method stub
		return getId();
	}
	@Transient
	@Override
	public String getTargetName() {
		// TODO Auto-generated method stub
		return "GROUPS" + getId();
	}
}

